<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" buffer="16kb" session="false" autoFlush="true"%>
<%@include file="/WEB-INF/jspf/tags.jspf" %>
jq.js,ut.js,vimg.js,formvalid.js"/>
    <style type="text/css">
        #tc_box{width:660px;}
        #tc_box table{width:650px;height:320px;}
        #tc_box table tr{height:46px;}
        #tc_box table td{font-size:14px;padding-left:9px;height:46px;}
        #tc_box {border:1px #CCC dotted;}
        #tc_box .s1{
            height:22px;border: solid 1px #C7C7C7;
            background:url('${ctxpath}/img/textbg.png') #fff repeat-x;
            -webkit-border-radius: .3em; 
            -moz-border-radius: .3em;
            border-radius: .3em;
            -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1);
            -moz-box-shadow: 0 1px 2px rgba(0,0,0,.1);
            box-shadow: 0 1px 2px rgba(0,0,0,.1);
            width:200px;
            padding:3px;
            font-size:14px;
        }
        #tc_box textarea.s2{
            border: solid 1px #C7C7C7;
            -webkit-border-radius: .3em; 
            -moz-border-radius: .3em;
            border-radius: .3em;
            -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1);
            -moz-box-shadow: 0 1px 2px rgba(0,0,0,.1);
            box-shadow: 0 1px 2px rgba(0,0,0,.1);
            padding:3px;
            font-size:14px;  
        }
        #tc_box input.s1:hover,#tc_box textarea.s2:hover{border-color:red;background-color:#ffffff;}
        #tc_box input.s1:focus,#tc_box textarea.s2:focus{background-color:#ffffff;border-color:#F87300;color:#000000;}
        span.red{color:red;}
        span.tip{color:#d0d0d0;font-size:12px;}
        h2.s3{padding:5px 0px 5px 19px;color:#ED8714;font-size:18px;}
    </style>
<div id="tc_box">
    <h2 class="s3">发表微评</h2>
    <form id="tcfrm" name="tcfrm" action="" method="post" enctype="application/x-www-form-urlencoded" target="_top">
        <input name="relateid" id="relateid" value="${root.relateid}" type="hidden"/>
        <input name="channeltype" id="channeltype" value="${root.channeltype}" type="hidden"/>
        <table>
            <tr>
                <td width="96" height="30" align="right">昵 称：</td>
                <td colspan="4">
                    <input type="text" name="nick" id="nick" tabindex="1" class="s1" maxlength="30"  valid="required" errmsg="昵称不能为空!"/>
                    <span class="red">*</span>
                </td>
                <td width="166"><div id="err_nick"></div></td>
            </tr>
            <tr>
                <td height="46" align="right">微评内容：</td>
                <td colspan="3">
                    <textarea name="content" id="content" cols="45" rows="5" tabindex="5" class="s2" valid="required|limit" min="2" max="180" errmsg="内容不能为空!|内容字数请控制在180个字内."></textarea>
                    <span class="red">*</span><br/>
                    <span class="tip">限180个字</span>
                </td>
                <td colspan="2"><div id="err_msg"></div></td>
            </tr>
            <tr>
                <td align="right">验 证 码：</td>
                <td width="125">
                    <input type="text" name="vcode" id="vcode" tabindex="6" style="width:90px;" class="s1" onfocus="VIMG.reload('s');"  valid="required" errmsg="验证码不能为空!"><span class="red">*</span></td>
                <td width="238"><img id="codeimg" src="${ctxpath}/img/vcode.jpg" width="93" height="29" align="middle" onclick="VIMG.reload();" title="点击图片刷新校验码" alt="点击图片刷新校验码"/></td>
                <td colspan="3"><div id="err_vcode"></div></td>
            </tr>
            <tr>
                <td colspan="6" align="center"><input type="button" name="submitBtn" id="submitBtn" onclick="TinyCmt.submit();" value="发布" class="button orange"></td>
            </tr>
        </table>

    </form>
</div>

<script type="text/javascript">
    VIMG.set(def.ctx+'/auth/code.srv');
    initValid(ut.e('tcfrm'));
    var TinyCmt={
        submit:function(){
            var $rb=$('#submitBtn');
            if(validator(ut.e('tcfrm'))){
                $rb.attr('disabled','disabled');
                $.post(def.ctx+'/tinycmt/save.shtm',ut.getFormData('#tcfrm'),function(x){
                    var r = $.trim(x);
                    if(r=='ok'){
                        ut.m('成功提交微评.请等待系统审核');
                        ut.reload('?t='+ut.r());
                    }else{
                        ut.m(r);
                        VIMG.reload();
                        $rb.removeAttr('disabled');
                    }
                });
            }
        }
    };
</script>


<a href="${ctxpath}/tinycmt/index.shtm?relateid=${root.infoid}&channeltype=${root.channeltype}">发表微评</a>